﻿
<template>
    <div>
        <el-select placeholder="请选择年级" v-if="!dx" size="mini" v-model="pzoption.value" class="form-control filter" style="height: 34px;padding:0px">
            <el-option v-for="item in njdata"
                       :key="item.nj"
                       :label="item.nj"
                       :value="item.nj">
            </el-option>
        </el-select>
        <el-select placeholder="请选择年级" v-if="dx" size="mini" v-model="pzoption.value" class="form-control filter" style="height: 34px;padding:0px" multiple collapse-tags>
            <el-option v-for="item in njdata"
                       :key="item.nj"
                       :label="item.nj"
                       :value="item.nj">
            </el-option>
        </el-select>
    </div>
</template>

<script>
    module.exports = {
        props: ['pzoption', 'isdx'],
        data() {
            return {
                njdata: [],
            };
        },
        computed: {
            dx: function () {
                return this.isdx == "";
            }
        },
        methods: {
            change: function ($event) {

            }
        },
        watch: {

        },
        mounted: function () {
            var chi = this;
            chi.$nextTick(function () {
                chi.njdata = JSON.parse(localStorage.getItem("njdata"));
                if (chi.dx) {
                    //_.forEach(chi.njdata, function (obj) {
                    //    chi.pzoption.value.push(obj.nj);
                    //})
                    chi.pzoption.value.push(chi.njdata[0].nj);

                } else {
                    chi.pzoption.value = chi.njdata[0].nj;

                }
            })

        }
    };
</script>